[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
twMInkeyWait( nSecs, lKeyExit, lMouseExit )
----------------------------------------------------------------------------
twMInkeyWait() is a replacement for twInkeyWait() with mouse
support.
Keystroke Handling:
If a key is pressed, twMInkeyWait() returns the value of the key
pressed. If nSecs is set to zero, twMInkeyWait() waits for either
a mouse button or a key to be pressed. You have the option of
remaining inside the 'wait' state after either keypresses or
button presses. Support for SETKEYS is included.
You may vary the behaviour of twMInkeyWait() with lKeyExit. If you
want keypresses NOT to exit the 'wait' state, set lKeyExit to
FALSE, which is the default.
Mouse Support:
The default mouse support varies according to the value of
lMouseExit. You may remain in the wait state after a button press
by setting lMouseExit to FALSE, the default. By combining your
choices of lKeyExit and lMouseExit, many variations are possible.
Support is included for SETKEYS and mouse hot spots so that you
can display hot spots and also have a key set to perform the same
action. For instance, you may want the escape key to allow an
exit but have no exit on the press of a mouse button except hot
spots. Assign a hot spot to stuff the keyboard buffer with K_ESC
to get out.
As with most TSDWIN mouse functions, the right button defaults to
EXIT.
Arguments:
nSecs - 'N' Timeout Value. If zero, wait forever. THE DEFAULT
IS ZERO, unlike twInkeyWait() and INKEY() which
exit if no key is pressed. twMInkeyWait() ALWAYS
waits for an event.
lKeyExit - 'L' Logical to allow/disallow exit on keypresses. The
default is .F., DON'T ALLOW EXIT.
lMouseExit - 'L' Logical to allow/disallow exit with button
presses. The default is .F., BUT, the right mouse
button ALWAYS reverts to EXIT.
Return:
Value of the key presses or 100 times the button number:
Left Button: 1
Right Button: 2
Both Buttons: 3
Example:
FUNCTION Main()
LOCAL nKey
twMouseInit()
DO WHILE .T.
// this will remain in the 'wait' state for all button presses
// except the right button. DO NOT assign the right button to
// hot spots for now. This will be corrected in a later version.
// All key presses will force an exit.
nKey := twMInkeyWait( , .T., .F. ) // Loop Forever.
DO CASE
CASE nKey = 27
EXIT
CASE nKey = 2000
EXIT
OTHERWISE
LOOP
ENDCASE
ENDDO
RETURN NIL
See Also:
twMIHotSpot()
twMIMouseLine()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson